using Tycho.Runtime;

namespace Tycho.PerformanceTests {
    public class InterfaceCastCall {
        private const int NumberOfCalls = 100000000;

        [BenchMark, Ignore]
        public static void InterfaceCastCalls () {
            object methodCall = new MethodCall ();

            for (int i = 0; i < NumberOfCalls; i++) {
                ((IMethodCall100) methodCall).ComputeStuff100 (null, null);
            }
        }

        [BenchMark, Ignore]
        public static void InterfaceCalls () {
            IMethodCall99 methodCall = new MethodCall ();

            for (int i = 0; i < NumberOfCalls; i++) {
                methodCall.ComputeStuff99 (null, null);
            }
        }

        [BenchMark, Ignore]
        public static void NormalCalls () {
            MethodCall methodCall = new MethodCall ();

            for (int i = 0; i < NumberOfCalls; i++) {
                methodCall.ComputeStuff1 (null, null);
            }
        }

        interface IMethodCall1 {
            AnyObject ComputeStuff1 (AnyObject a, AnyObject b);
        }
        interface IMethodCall2 {
            AnyObject ComputeStuff2 (AnyObject a, AnyObject b);
        }
        interface IMethodCall3 {
            AnyObject ComputeStuff3 (AnyObject a, AnyObject b);
        }
        interface IMethodCall4 {
            AnyObject ComputeStuff4 (AnyObject a, AnyObject b);
        }
        interface IMethodCall5 {
            AnyObject ComputeStuff5 (AnyObject a, AnyObject b);
        }
        interface IMethodCall6 {
            AnyObject ComputeStuff6 (AnyObject a, AnyObject b);
        }
        interface IMethodCall7 {
            AnyObject ComputeStuff7 (AnyObject a, AnyObject b);
        }
        interface IMethodCall8 {
            AnyObject ComputeStuff8 (AnyObject a, AnyObject b);
        }
        interface IMethodCall9 {
            AnyObject ComputeStuff9 (AnyObject a, AnyObject b);
        }
        interface IMethodCall10 {
            AnyObject ComputeStuff10 (AnyObject a, AnyObject b);
        }
        interface IMethodCall11 {
            AnyObject ComputeStuff11 (AnyObject a, AnyObject b);
        }
        interface IMethodCall12 {
            AnyObject ComputeStuff12 (AnyObject a, AnyObject b);
        }
        interface IMethodCall13 {
            AnyObject ComputeStuff13 (AnyObject a, AnyObject b);
        }
        interface IMethodCall14 {
            AnyObject ComputeStuff14 (AnyObject a, AnyObject b);
        }
        interface IMethodCall15 {
            AnyObject ComputeStuff15 (AnyObject a, AnyObject b);
        }
        interface IMethodCall16 {
            AnyObject ComputeStuff16 (AnyObject a, AnyObject b);
        }
        interface IMethodCall17 {
            AnyObject ComputeStuff17 (AnyObject a, AnyObject b);
        }
        interface IMethodCall18 {
            AnyObject ComputeStuff18 (AnyObject a, AnyObject b);
        }
        interface IMethodCall19 {
            AnyObject ComputeStuff19 (AnyObject a, AnyObject b);
        }
        interface IMethodCall20 {
            AnyObject ComputeStuff20 (AnyObject a, AnyObject b);
        }
        interface IMethodCall21 {
            AnyObject ComputeStuff21 (AnyObject a, AnyObject b);
        }
        interface IMethodCall22 {
            AnyObject ComputeStuff22 (AnyObject a, AnyObject b);
        }
        interface IMethodCall23 {
            AnyObject ComputeStuff23 (AnyObject a, AnyObject b);
        }
        interface IMethodCall24 {
            AnyObject ComputeStuff24 (AnyObject a, AnyObject b);
        }
        interface IMethodCall25 {
            AnyObject ComputeStuff25 (AnyObject a, AnyObject b);
        }
        interface IMethodCall26 {
            AnyObject ComputeStuff26 (AnyObject a, AnyObject b);
        }
        interface IMethodCall27 {
            AnyObject ComputeStuff27 (AnyObject a, AnyObject b);
        }
        interface IMethodCall28 {
            AnyObject ComputeStuff28 (AnyObject a, AnyObject b);
        }
        interface IMethodCall29 {
            AnyObject ComputeStuff29 (AnyObject a, AnyObject b);
        }
        interface IMethodCall30 {
            AnyObject ComputeStuff30 (AnyObject a, AnyObject b);
        }
        interface IMethodCall31 {
            AnyObject ComputeStuff31 (AnyObject a, AnyObject b);
        }
        interface IMethodCall32 {
            AnyObject ComputeStuff32 (AnyObject a, AnyObject b);
        }
        interface IMethodCall33 {
            AnyObject ComputeStuff33 (AnyObject a, AnyObject b);
        }
        interface IMethodCall34 {
            AnyObject ComputeStuff34 (AnyObject a, AnyObject b);
        }
        interface IMethodCall35 {
            AnyObject ComputeStuff35 (AnyObject a, AnyObject b);
        }
        interface IMethodCall36 {
            AnyObject ComputeStuff36 (AnyObject a, AnyObject b);
        }
        interface IMethodCall37 {
            AnyObject ComputeStuff37 (AnyObject a, AnyObject b);
        }
        interface IMethodCall38 {
            AnyObject ComputeStuff38 (AnyObject a, AnyObject b);
        }
        interface IMethodCall39 {
            AnyObject ComputeStuff39 (AnyObject a, AnyObject b);
        }
        interface IMethodCall40 {
            AnyObject ComputeStuff40 (AnyObject a, AnyObject b);
        }
        interface IMethodCall41 {
            AnyObject ComputeStuff41 (AnyObject a, AnyObject b);
        }
        interface IMethodCall42 {
            AnyObject ComputeStuff42 (AnyObject a, AnyObject b);
        }
        interface IMethodCall43 {
            AnyObject ComputeStuff43 (AnyObject a, AnyObject b);
        }
        interface IMethodCall44 {
            AnyObject ComputeStuff44 (AnyObject a, AnyObject b);
        }
        interface IMethodCall45 {
            AnyObject ComputeStuff45 (AnyObject a, AnyObject b);
        }
        interface IMethodCall46 {
            AnyObject ComputeStuff46 (AnyObject a, AnyObject b);
        }
        interface IMethodCall47 {
            AnyObject ComputeStuff47 (AnyObject a, AnyObject b);
        }
        interface IMethodCall48 {
            AnyObject ComputeStuff48 (AnyObject a, AnyObject b);
        }
        interface IMethodCall49 {
            AnyObject ComputeStuff49 (AnyObject a, AnyObject b);
        }
        interface IMethodCall50 {
            AnyObject ComputeStuff50 (AnyObject a, AnyObject b);
        }
        interface IMethodCall51 {
            AnyObject ComputeStuff51 (AnyObject a, AnyObject b);
        }
        interface IMethodCall52 {
            AnyObject ComputeStuff52 (AnyObject a, AnyObject b);
        }
        interface IMethodCall53 {
            AnyObject ComputeStuff53 (AnyObject a, AnyObject b);
        }
        interface IMethodCall54 {
            AnyObject ComputeStuff54 (AnyObject a, AnyObject b);
        }
        interface IMethodCall55 {
            AnyObject ComputeStuff55 (AnyObject a, AnyObject b);
        }
        interface IMethodCall56 {
            AnyObject ComputeStuff56 (AnyObject a, AnyObject b);
        }
        interface IMethodCall57 {
            AnyObject ComputeStuff57 (AnyObject a, AnyObject b);
        }
        interface IMethodCall58 {
            AnyObject ComputeStuff58 (AnyObject a, AnyObject b);
        }
        interface IMethodCall59 {
            AnyObject ComputeStuff59 (AnyObject a, AnyObject b);
        }
        interface IMethodCall60 {
            AnyObject ComputeStuff60 (AnyObject a, AnyObject b);
        }
        interface IMethodCall61 {
            AnyObject ComputeStuff61 (AnyObject a, AnyObject b);
        }
        interface IMethodCall62 {
            AnyObject ComputeStuff62 (AnyObject a, AnyObject b);
        }
        interface IMethodCall63 {
            AnyObject ComputeStuff63 (AnyObject a, AnyObject b);
        }
        interface IMethodCall64 {
            AnyObject ComputeStuff64 (AnyObject a, AnyObject b);
        }
        interface IMethodCall65 {
            AnyObject ComputeStuff65 (AnyObject a, AnyObject b);
        }
        interface IMethodCall66 {
            AnyObject ComputeStuff66 (AnyObject a, AnyObject b);
        }
        interface IMethodCall67 {
            AnyObject ComputeStuff67 (AnyObject a, AnyObject b);
        }
        interface IMethodCall68 {
            AnyObject ComputeStuff68 (AnyObject a, AnyObject b);
        }
        interface IMethodCall69 {
            AnyObject ComputeStuff69 (AnyObject a, AnyObject b);
        }
        interface IMethodCall70 {
            AnyObject ComputeStuff70 (AnyObject a, AnyObject b);
        }
        interface IMethodCall71 {
            AnyObject ComputeStuff71 (AnyObject a, AnyObject b);
        }
        interface IMethodCall72 {
            AnyObject ComputeStuff72 (AnyObject a, AnyObject b);
        }
        interface IMethodCall73 {
            AnyObject ComputeStuff73 (AnyObject a, AnyObject b);
        }
        interface IMethodCall74 {
            AnyObject ComputeStuff74 (AnyObject a, AnyObject b);
        }
        interface IMethodCall75 {
            AnyObject ComputeStuff75 (AnyObject a, AnyObject b);
        }
        interface IMethodCall76 {
            AnyObject ComputeStuff76 (AnyObject a, AnyObject b);
        }
        interface IMethodCall77 {
            AnyObject ComputeStuff77 (AnyObject a, AnyObject b);
        }
        interface IMethodCall78 {
            AnyObject ComputeStuff78 (AnyObject a, AnyObject b);
        }
        interface IMethodCall79 {
            AnyObject ComputeStuff79 (AnyObject a, AnyObject b);
        }
        interface IMethodCall80 {
            AnyObject ComputeStuff80 (AnyObject a, AnyObject b);
        }
        interface IMethodCall81 {
            AnyObject ComputeStuff81 (AnyObject a, AnyObject b);
        }
        interface IMethodCall82 {
            AnyObject ComputeStuff82 (AnyObject a, AnyObject b);
        }
        interface IMethodCall83 {
            AnyObject ComputeStuff83 (AnyObject a, AnyObject b);
        }
        interface IMethodCall84 {
            AnyObject ComputeStuff84 (AnyObject a, AnyObject b);
        }
        interface IMethodCall85 {
            AnyObject ComputeStuff85 (AnyObject a, AnyObject b);
        }
        interface IMethodCall86 {
            AnyObject ComputeStuff86 (AnyObject a, AnyObject b);
        }
        interface IMethodCall87 {
            AnyObject ComputeStuff87 (AnyObject a, AnyObject b);
        }
        interface IMethodCall88 {
            AnyObject ComputeStuff88 (AnyObject a, AnyObject b);
        }
        interface IMethodCall89 {
            AnyObject ComputeStuff89 (AnyObject a, AnyObject b);
        }
        interface IMethodCall90 {
            AnyObject ComputeStuff90 (AnyObject a, AnyObject b);
        }
        interface IMethodCall91 {
            AnyObject ComputeStuff91 (AnyObject a, AnyObject b);
        }
        interface IMethodCall92 {
            AnyObject ComputeStuff92 (AnyObject a, AnyObject b);
        }
        interface IMethodCall93 {
            AnyObject ComputeStuff93 (AnyObject a, AnyObject b);
        }
        interface IMethodCall94 {
            AnyObject ComputeStuff94 (AnyObject a, AnyObject b);
        }
        interface IMethodCall95 {
            AnyObject ComputeStuff95 (AnyObject a, AnyObject b);
        }
        interface IMethodCall96 {
            AnyObject ComputeStuff96 (AnyObject a, AnyObject b);
        }
        interface IMethodCall97 {
            AnyObject ComputeStuff97 (AnyObject a, AnyObject b);
        }
        interface IMethodCall98 {
            AnyObject ComputeStuff98 (AnyObject a, AnyObject b);
        }
        interface IMethodCall99 {
            AnyObject ComputeStuff99 (AnyObject a, AnyObject b);
        }
        interface IMethodCall100 {
            AnyObject ComputeStuff100 (AnyObject a, AnyObject b);
        }

        internal class MethodCall : IMethodCall1, IMethodCall2, IMethodCall3, IMethodCall4, IMethodCall5, IMethodCall6, IMethodCall7, IMethodCall8, IMethodCall9, IMethodCall10, IMethodCall11, IMethodCall12, IMethodCall13, IMethodCall14, IMethodCall15, IMethodCall16, IMethodCall17, IMethodCall18, IMethodCall19, IMethodCall20, IMethodCall21, IMethodCall22, IMethodCall23, IMethodCall24, IMethodCall25, IMethodCall26, IMethodCall27, IMethodCall28, IMethodCall29, IMethodCall30, IMethodCall31, IMethodCall32, IMethodCall33, IMethodCall34, IMethodCall35, IMethodCall36, IMethodCall37, IMethodCall38, IMethodCall39, IMethodCall40, IMethodCall41, IMethodCall42, IMethodCall43, IMethodCall44, IMethodCall45, IMethodCall46, IMethodCall47, IMethodCall48, IMethodCall49, IMethodCall50, IMethodCall51, IMethodCall52, IMethodCall53, IMethodCall54, IMethodCall55, IMethodCall56, IMethodCall57, IMethodCall58, IMethodCall59, IMethodCall60, IMethodCall61, IMethodCall62, IMethodCall63, IMethodCall64, IMethodCall65, IMethodCall66, IMethodCall67, IMethodCall68, IMethodCall69, IMethodCall70, IMethodCall71, IMethodCall72, IMethodCall73, IMethodCall74, IMethodCall75, IMethodCall76, IMethodCall77, IMethodCall78, IMethodCall79, IMethodCall80, IMethodCall81, IMethodCall82, IMethodCall83, IMethodCall84, IMethodCall85, IMethodCall86, IMethodCall87, IMethodCall88, IMethodCall89, IMethodCall90, IMethodCall91, IMethodCall92, IMethodCall93, IMethodCall94, IMethodCall95, IMethodCall96, IMethodCall97, IMethodCall98, IMethodCall99, IMethodCall100 {
            public AnyObject ComputeStuff1 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff2 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff3 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff4 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff5 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff6 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff7 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff8 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff9 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff10 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff11 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff12 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff13 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff14 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff15 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff16 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff17 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff18 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff19 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff20 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff21 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff22 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff23 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff24 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff25 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff26 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff27 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff28 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff29 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff30 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff31 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff32 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff33 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff34 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff35 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff36 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff37 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff38 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff39 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff40 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff41 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff42 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff43 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff44 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff45 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff46 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff47 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff48 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff49 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff50 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff51 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff52 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff53 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff54 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff55 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff56 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff57 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff58 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff59 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff60 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff61 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff62 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff63 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff64 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff65 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff66 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff67 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff68 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff69 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff70 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff71 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff72 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff73 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff74 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff75 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff76 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff77 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff78 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff79 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff80 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff81 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff82 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff83 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff84 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff85 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff86 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff87 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff88 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff89 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff90 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff91 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff92 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff93 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff94 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff95 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff96 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff97 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff98 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff99 (AnyObject a, AnyObject b) {
                return null;
            }
            public AnyObject ComputeStuff100 (AnyObject a, AnyObject b) {
                return null;
            }
        }
    }
}